package pong.util;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Util {
	public static void save(String username){
		try{
			FileOutputStream file = new FileOutputStream("info");
			ObjectOutputStream es = new ObjectOutputStream(file);
			es.writeObject(username);
			file.close();
			es.close();
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static String read(){
		try{
			FileInputStream file = new FileInputStream("info");
			ObjectInputStream es = new ObjectInputStream(file);
			try{
				return (String) es.readObject();
			}catch(Exception e){ return "";}
			finally{
				file.close();
				es.close();
			}
		}catch (Exception e) {
			return "";
		}
	}
}
